﻿using System;
using Epam.PeopleInterfaces;
using Epam.PeopleModel;


namespace Epam.BusinessLogic
{
    public static class PeopleMapper
    {
        public static IPeopleEntity Convert(IDtoPeopleEntity item)
        {
            return new PeopleEntity(item.Id,item.Name,item.BirthDate,item.Weight,item.Height);
        }

        public static IViewPeopleEntity Convert(IPeopleEntity item,IFilterAlgoritm filterAlgoritm)
        {
            return new ViewPeopleEntity(item.Name, filterAlgoritm.FiltrateByFactor(item.Weight,item.Height), DateTime.Now.Year - item.BirthDate.Year);
        }

        public static IViewPeopleEntity ConvertDtoToView(IDtoPeopleEntity item,IFilterAlgoritm filterAlgoritm)
        {
            return new ViewPeopleEntity(item.Name, filterAlgoritm.FiltrateByFactor(item.Weight, item.Height), DateTime.Now.Year - item.BirthDate.Year);
        }
    }
}
